package file;

import jdk.management.resource.internal.inst.FileOutputStreamRMHooks;

import java.io.File;
import java.io.FileFilter;

public class FileFilterDemo {
    public static void main(String[] args) {
        File dir = new File("./src/main/java/file");
        if (dir.isDirectory()){
            FileFilter filter = new FileFilter() {
                @Override
                public boolean accept(File pathname) {
                    String name = pathname.getName();
                   // return name.startsWith("D");
                    long len = name.length();
                    return  len < 900;
                }
            };

            File[] files = dir.listFiles(filter);
            for (File file : files){
                System.out.println( file.getName());
            }
        }
    }
}
